package de.umr.fb12.vs.os;

public interface SchedClass {
	/**
	 * Called if a process wants to re-enqueue itself to this scheduler.
	 * 
	 * @param curr
	 *            the current executing process
	 * @param enq
	 *            the process which wants to enqueue
	 */
	public void enqueue_task(Task curr, Task enq);

	/**
	 * Called if a process wants to de-queue from this scheduler. Reasons could
	 * be like going to block, exit or changing the scheduler class. NOTE:
	 * Parameters are not necessary equal.
	 * 
	 * @param curr
	 *            the current executing process
	 * @param deq
	 *            the process which wants to dequeue
	 */
	public void dequeue_task(Task curr, Task deq);

	/**
	 * Called if a process wants to leave the CPU.
	 * 
	 * @param curr
	 *            current executing task
	 * @param t
	 *            the task issued the yield
	 */
	public void yield_task(Task curr, Task t);

	/**
	 * Called from the Core scheduler in schedule() function if the current task
	 * is set need resched. The schedule function is invoked after the scheduler
	 * is on the way back to execute the current task. Basically after every
	 * call in this interface. (Virtual Syscalls or returing from IRQs)
	 * 
	 * @return must return the process which shell executed next, if no task
	 *         present return null and the next Schedclass will be asked.
	 */
	public Task pick_next_task();

	/**
	 * Is called right before pick_next_task with the current task.
	 * 
	 * @param prev
	 *            the previous (current) task NOTE: it is possible that the
	 *            previous task is scheduled by an different SchedClass.
	 */
	public void put_prev_task(Task prev);

	/**
	 * Periodically called via IRQs
	 * 
	 * @param curr
	 *            the current executing process
	 */
	public void task_tick(Task curr);

	/**
	 * Called if a new process is created. After creation enqueue is not called
	 * automatically.
	 * 
	 * @param curr
	 *            the current executing process
	 * @param newtsk
	 *            the new task
	 */
	void task_new(Task curr, Task newtsk);

}
